import {NgModule} from '@angular/core';

import {RouterModule, Routes} from '@angular/router';
import {PageNotFoundComponent} from './shared/page-not-found/page-not-found.component';

import {AuthGuardService} from './service/authGuardService/auth-guard.service';
import {SelectivePreloadingStrategy} from './selective-preloading-strategy';
import {ComposeMessageComponent} from './compose-message/compose-message.component';


const appRoutes: Routes = [
  {path: '', pathMatch: 'full', redirectTo: 'heroes'},
  {
    path: 'admin', loadChildren: 'app/admin/admin.module#AdminModule'
    , canLoad: [AuthGuardService]
  },
  {
    path: 'crisis-center',
    loadChildren: 'app/crisis-center/crisis-center.module#CrisisCenterModule',
    data: { preload: true }
  },
  {
    path: 'compose',
    component: ComposeMessageComponent,
    outlet: 'popup'
  },
  {path: '**', component: PageNotFoundComponent},


];


@NgModule({
  imports: [
    RouterModule.forRoot(appRoutes,
      {preloadingStrategy: SelectivePreloadingStrategy})
  ],
  exports: [
    RouterModule
  ],
  providers: [

    SelectivePreloadingStrategy
  ]
})
export class AppRoutingModule {
}
